import M from 'md5';
export function MD5(obj) {
  let apiPregFormat = 'da14db99f63ac76ef0bb187d599308da';
  var newObj = {};
  var tempArr = [];
  var newkey = Object.keys(obj).sort();
  for (let i = 0; i < newkey.length; i++) {
    newObj[newkey[i]] = obj[newkey[i]];
  };
  for (let i in newObj) {
    tempArr.push(i + '=' + newObj[i]);
  };
  console.log(tempArr.join('&') + "&pregformat=i am a key.");
  tempArr.push('pregformat=' + apiPregFormat);
  var signBefore = tempArr.join('&');
  console.log(signBefore);
  return M(signBefore);
};
